package com.zui.entity.setup;

import java.util.LinkedHashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.sun.istack.internal.NotNull;
import com.zui.entity.BaseAssignedIdEntity;


@Entity
@Table(name="contact_mech_type")
public class ContactMechType extends BaseAssignedIdEntity {
	private static final long serialVersionUID = 1L;
	
	public static final String TYPE_POSTAL_ADDRESS = "POSTAL_ADDRESS";
	public static final String TYPE_ELECTRONIC_ADDRESS = "ELECTRONIC_ADDRESS";
	public static final String TYPE_TELCOM_NUMBER = "TELCOM_NUMBER";
	
	public ContactMechType() {};
	public ContactMechType(String id) {this.id=id;};
	
	private String name;
	private Set<ContactMechPurposeType> contactMechPurposes = new LinkedHashSet<ContactMechPurposeType>();
	
	/*------------------------------
	 * getters and annotations
	 --------------------------------*/
	
	@Column(length=50) @NotNull
	public String getName() {return name;}
	
	@OneToMany(mappedBy = "contactMechType", fetch = FetchType.LAZY)
	public Set<ContactMechPurposeType> getContactMechPurposes() {
		return contactMechPurposes;
	}
	
	public void setContactMechPurposes(
			Set<ContactMechPurposeType> contactMechPurposes) {
		this.contactMechPurposes = contactMechPurposes;
	}
	public void setName(String name) {
		this.name = name;
	}
}
